import request from "@/utils/request";
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询每日考勤汇总列表
export function listUserDayAttendanceSum(query) {
  return request({
    url: "/workAttendanceApi/getAttendanceSumDailyRecord",
    method: "get",
    params: query
  });
}

export function userDayAttendanceSumExport(data) {
  return request({
    url: "/workJobApi/monthlyAttendance/userDayAttendanceSumExport",
    method: "get",
    params: data
  });
}

// 查询每日考勤明细列表
export function listUserDayAttendance(query) {
  return request({
    url: "/workAttendanceApi/getAttendanceRecord",
    method: "get",
    params: query
  });
}

// 日考勤报表明细导出
export function userDayAttendanceExport(ids) {
  return request({
    url: "/workAttendanceApi/exportAttendance/" + ids,
    method: "get"
  });
}

// 2021-12-08 11:29:11 by 陈宇寰
// 需求变更，由原来的勾选导出改为条件导出
// 日考勤报表明细导出
export function userDayAttendanceExportWithCondition(query) {
  return request({
    url: "/workAttendanceApi/exportAttendance/export",
    method: "get",
    params: query
  });
}

export function userMonthAttendanceExport(query) {
  return request({
    url: "/workAttendanceApi/exportAttendanceMonth/",
    method: "get",
    params: query
  });
}
// 查询每月考勤汇总列表
export function listUserMonthAttendanceSum(query) {
  return request({
    ///workAttendanceApi/getAttendanceSumMonthRecord?workTime=demoData&deptName=demoData&deptId=1
    url: "/workAttendanceApi/getAttendanceSumMonthRecord",
    method: "get",
    params: query
  });
}
export function userMonthAttendanceSumExport(data) {
  return request({
    url: "/workJobApi/monthlyAttendance/userMonthAttendanceSumExport",
    method: "get",
    params: data
  });
}
// 查询每月考勤明细列表
export function listUserMonthAttendance(query) {
  ///workAttendanceApi/getAttendanceMonthRecord
  return request({
    url: "/workAttendanceApi/getAttendanceMonthRecord",
    method: "get",
    params: query
  });
}
// 查询每月考勤明细列表
export function getStaffAttendanceMonthList(query) {
  ///workAttendanceApi/getAttendanceMonthRecord
  return request({
    url: "/workAttendanceApi/getAttendanceMonthRecordByIdCard",
    method: "get",
    params: query
  });
}

// 查询日期表头
export function getDateArray(date) {
  return request({
    url: "/workJobApi/monthlyAttendance/getDateArray/" + praseStrEmpty(date),
    method: "get"
  });
}
export function attendanceDailyRecord(data) {
  let requestData = {
    workTime: data
  };
  return request({
    url: "/workAttendanceApi/saveAttendanceRecord",
    method: "post",
    data: requestData
  });
}

// 个人通行记录查询
export function listAttendancePassRecord(query) {
  return request({
    url: "/workAttendanceApi/getAttendancePassRecord",
    method: "get",
    params: query
  });
}
